package step2;

import java.io.IOException;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;

/**
 * 클라이언트 프로그램 
 * 서버에 메세지를 출력하는 프로그램 만들기 
 * 1. Socket 생성 (ip,port)
 * 2. socket.getOutputStream()
 * 3. PrintWriter 
 * 4. println("")
 * 5. close()
 * @author kosta-00-kangsa-001
 *
 */
public class TestClient2 {

	public void go() throws UnknownHostException, IOException{
		Socket socket=new Socket("192.168.7.44",5432);
		PrintWriter pw=new PrintWriter(socket.getOutputStream(),true);
		pw.println("방가방가");
		System.out.println("서버에 데이터 전송....");
		pw.close();
		socket.close();
	}
	public static void main(String[] args) {
		TestClient2 client=new TestClient2();
		try {
			client.go();
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}










